<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/index.css" />
	</head>
	<body style="padding: 0px;margin: 0px;background: #383838;">
		<div id="app" style="width: 100%;">
			
		</div>
	</body>
	<!-- 引入uniapp的SDK-->
	<script type="text/javascript" src="./js/uni.webview.1.5.4.js">
	</script>
	<!-- 引入vue方法-->
	<script src="./js/vue.js"></script>
	<script type="text/javascript" src="./js/mtvd.js"></script>
	<script type="text/javascript">
		function getQueryVariable(variable) {
			var query = window.location.search.substring(1);
			var vars = query.split("&");
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split("=");
				if (pair[0] == variable) {
					return pair[1];
				}
			}
			return "";
		};
		
		const id = getQueryVariable("id")
		const name = getQueryVariable("name")
		const roomId = "videochat"
		app.initData({id,name,roomId})
		// 在引用依赖的文件后，需要在 HTML 中监听 UniAppJSBridgeReady 事件触发后，才能安全调用 uni 的 API。  
		document.addEventListener('UniAppJSBridgeReady', function() {
			uni.getEnv(function(res) {
				console.log('获取当前环境：' + JSON.stringify(res));
				app.publishStream({video:true,audio:false})
			});
		});
		
		// HTML 接受APP发送过来的消息 (H5端)
		window.addEventListener('message', e => {
			console.log(e,'HTML 接受APP发送过来的消息 (H5端)');
		}, false)


		// HTML 接受APP发送过来的消息 (APP端)
		function requestData(data) {
			console.log(JSON.stringify(data),'HTML 接受APP发送过来的消息 (APP端)');
			app.dataList = data.navigation // 赋值
		}
	</script>
</html>

